Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): Remove SlidingSyncInner::past_positions #3833

Merged

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Aug 12, 2024

The patch #2395 has introduced SlidingSyncInner::past_positions as a mechanism to filter duplicated responses. It was a problem because the sliding sync ops could easily create corrupted states if they were applied more than once.

Since #3664, ops are ignored.

Now, past_positions create a problem with the sliding sync native implementation inside Synapse because pos can stay the same between multiple responses.

While past_positions was helpful to fix bugs in the past, it's no longer necessary today. Moreover, it breaks an invariant about pos: we must consider it as a blackbox. It means we must ignore if a pos value has been received in the past or not. This invariant has been broken for good reasons, but it now creates new issues.

This patch removes past_positions, along with the associated code (like Error::ResponseAlreadyReceived for example).

The patch matrix-org#2395 has
introduced `SlidingSyncInner::past_positions` as a mechanism to filter
duplicated responses. It was a problem because the sliding sync `ops`
could easily create corrupted states if they were applied more than
once.

Since matrix-org#3664, `ops`
are ignored.

Now, `past_positions` create a problem with the sliding sync native
implementation inside Synapse because `pos` can stay the same between
multiple responses.

While `past_positions` was helpful to fix bugs in the past, it's no
longer necessary today. Moreover, it breaks an invariant about `pos`: we
must consider it as a blackbox. It means we must ignore if a `pos` value
has been received in the past or not. This invariant has been broken for
good reasons, but it now creates new issues.

This patch removes `past_positions`, along with the associated code
(like `Error::ResponseAlreadyReceived` for example).
@Hywan Hywan requested a review from a team as a code owner August 12, 2024 12:06
@Hywan Hywan requested review from jmartinesp, bnjbvr and stefanceriu and removed request for a team and jmartinesp August 12, 2024 12:06
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasoning sounds good to me, code looks fine too 👍

@bnjbvr bnjbvr removed their request for review August 12, 2024 12:22
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.10%. Comparing base (35b62a1) to head (1ce90ab).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3833      +/-   ##
==========================================
- Coverage   84.12%   84.10%   -0.02%     
==========================================
  Files         263      263              
  Lines       27592    27582      -10     
==========================================
- Hits        23211    23199      -12     
- Misses       4381     4383       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hywan Hywan merged commit d143c61 into matrix-org:main Aug 12, 2024
40 checks passed
@Hywan Hywan mentioned this pull request Aug 14, 2024
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants